package com.lfy.Factor.comm.abs;

import com.lfy.Factor.comm.CaoService;

import java.util.ArrayList;
import java.util.List;

public class AbsFacotry {
    private List<CaoS> list = new ArrayList<>();
    private static AbsFacotry facotry = new AbsFacotry();

    public static AbsFacotry getInstance(){
        return facotry;
    }

    public void register(CaoS caoS){
        list.add(caoS);
    }

    public String parse(Integer code){
        for (CaoS caoService : list) {
            if(caoService.parse(code)){
                return caoService.name();
            }
        }
        return null;
    }
}
